//
//  AdminTable.m
//  TraineeManagementSystem
//
//  Created by Dhanashree Bodas on 28/01/15.
//  Copyright (c) 2015 Dhanashree Bodas. All rights reserved.
//

#import "AdminTable.h"

@implementation AdminTable



-(int) Login:(NSString *)username andPassword:(NSString *)pswd
{

    NSString *query=[NSString stringWithFormat:@"select aid from Admin where email='%@' and password='%@'",username,pswd];
    
   self.db=[[DBManager alloc] initWithDatabaseFilename:@"tmsdb.sql"];
    
    NSArray *admindata=[[NSArray alloc] init];
    admindata=[self.db loadDataFromDB:query];
    
    if(admindata.count!=0)
    {
        NSString * aid=[[admindata objectAtIndex:0] objectAtIndex:[self.db.arrColumnNames indexOfObject:@"aid"]];

            int a=[aid intValue];
            return a;
    }
    return 0;
    
}



@end
